# eric7.WebBrowser.Sync.FtpSyncHandler

Module implementing a synchronization handler using FTP.

### Global Attributes

None

### Classes

FtpSyncHandler | Class implementing a synchronization handler using FTP.

### Functions

None

## FtpSyncHandler

Class implementing a synchronization handler using FTP.

### Signals

syncError(message)
  emitted for a general error with the error message
syncFinished(type_, done, download)
  emitted after a synchronization has finished
syncMessage(message)
  emitted to send a message about synchronization
syncStatus(type_, message)
  emitted to indicate the synchronization status

### Derived from

SyncHandler

### Class Attributes

None

### Class Methods

None

### Methods

FtpSyncHandler | Constructor
__changeToStore | Private slot to change to the storage directory.
__connectAndLogin | Private method to connect to the FTP server and log in.
__dirListCallback | Private slot handling the receipt of directory listing lines.
__doFtpCommands | Private slot executing the sequence of FTP commands.
__downloadFile | Private method to downlaod the given file.
__downloadFileCallback | Private method receiving the downloaded data.
__idleTimeout | Private slot to prevent a disconnect from the server.
__initialSync | Private slot to do the initial synchronization.
__initialSyncFile | Private method to do the initial synchronization of the given file.
__syncFile | Private method to synchronize the given file.
__uploadFile | Private method to upload the given file.
initialLoadAndCheck | Public method to do the initial check.
shutdown | Public method to shut down the handler.
syncBookmarks | Public method to synchronize the bookmarks.
syncHistory | Public method to synchronize the history.
syncPasswords | Public method to synchronize the passwords.
syncSpeedDial | Public method to synchronize the speed dial data.
syncUserAgents | Public method to synchronize the user agents.

### Static Methods

None

#### FtpSyncHandler (Constructor)

FtpSyncHandler(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### FtpSyncHandler.__changeToStore

__changeToStore()

Private slot to change to the storage directory.

This action will create the storage path on the server, if it does not exist. Upon return, the current directory of the server is the sync directory.

#### FtpSyncHandler.__connectAndLogin

__connectAndLogin()

Private method to connect to the FTP server and log in.

Return:
  flag indicating a successful log in

Return Type:
  bool

#### FtpSyncHandler.__dirListCallback

__dirListCallback(line)

Private slot handling the receipt of directory listing lines.

line (str)
  the received line of the directory listing

#### FtpSyncHandler.__doFtpCommands

__doFtpCommands()

Private slot executing the sequence of FTP commands.

#### FtpSyncHandler.__downloadFile

__downloadFile(type_, fileName, timestamp)

Private method to downlaod the given file.

type_ (str)
  type of the synchronization event (one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
fileName (str)
  name of the file to be downloaded
timestamp (int)
  time stamp in seconds of the file to be downloaded

#### FtpSyncHandler.__downloadFileCallback

__downloadFileCallback(buffer, data)

Private method receiving the downloaded data.

buffer (io.BytesIO)
  reference to the buffer
data (bytes)
  byte string to store in the buffer

Return:
  number of bytes written to the buffer

Return Type:
  int

#### FtpSyncHandler.__idleTimeout

__idleTimeout()

Private slot to prevent a disconnect from the server.

#### FtpSyncHandler.__initialSync

__initialSync()

Private slot to do the initial synchronization.

#### FtpSyncHandler.__initialSyncFile

__initialSyncFile(type_, fileName)

Private method to do the initial synchronization of the given file.

type_ (str)
  type of the synchronization event (one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
fileName (str)
  name of the file to be synchronized

#### FtpSyncHandler.__syncFile

__syncFile(type_, fileName)

Private method to synchronize the given file.

type_ (str)
  type of the synchronization event (one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
fileName (str)
  name of the file to be synchronized

#### FtpSyncHandler.__uploadFile

__uploadFile(type_, fileName)

Private method to upload the given file.

type_ (str)
  type of the synchronization event (one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
fileName (str)
  name of the file to be uploaded

Return:
  flag indicating success

Return Type:
  bool

#### FtpSyncHandler.initialLoadAndCheck

initialLoadAndCheck(forceUpload)

Public method to do the initial check.

forceUpload (bool)
  flag indicating a forced upload of the files

#### FtpSyncHandler.shutdown

shutdown()

Public method to shut down the handler.

#### FtpSyncHandler.syncBookmarks

syncBookmarks()

Public method to synchronize the bookmarks.

#### FtpSyncHandler.syncHistory

syncHistory()

Public method to synchronize the history.

#### FtpSyncHandler.syncPasswords

syncPasswords()

Public method to synchronize the passwords.

#### FtpSyncHandler.syncSpeedDial

syncSpeedDial()

Public method to synchronize the speed dial data.

#### FtpSyncHandler.syncUserAgents

syncUserAgents()

Public method to synchronize the user agents.

Up